.class public Lcom/melesta/engine/EngineApp;
.super Landroid/app/Application;
.source "EngineApp.java"


# static fields
.field protected static final PREFS_DEVICE_ID:Ljava/lang/String; = "device_id"

.field protected static final PREFS_DEVICE_ID_FILE:Ljava/lang/String; = "device_id.xml"

.field private static instance:Lcom/melesta/engine/EngineApp;

.field private static mTD1PackageNames:[Ljava/lang/String;

.field private static mTD2PackageNames:[Ljava/lang/String;

.field private static mUuid:Ljava/lang/String;


# instance fields
.field private mLanguage:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 6

    .prologue
    const/4 v5, 0x3

    const/4 v4, 0x2

    const/4 v3, 0x1

    const/4 v2, 0x0

    .line 29
    new-array v0, v5, [Ljava/lang/String;

    const-string v1, "com.melesta.toydefense"

    aput-object v1, v0, v2

    const-string v1, "com.melesta.amazon.toydefense"

    aput-object v1, v0, v3

    const-string v1, "com.melesta.amazon.toydefensefree"

    aput-object v1, v0, v4

    sput-object v0, Lcom/melesta/engine/EngineApp;->mTD1PackageNames:[Ljava/lang/String;

    .line 33
    const/4 v0, 0x4

    new-array v0, v0, [Ljava/lang/String;

    const-string v1, "com.melesta.toydefense2"

    aput-object v1, v0, v2

    const-string v1, "com.melesta.toydefense2free"

    aput-object v1, v0, v3

    const-string v1, "com.melesta.amazon.toydefense2"

    aput-object v1, v0, v4

    const-string v1, "com.melesta.amazon.toydefense2free"

    aput-object v1, v0, v5

    sput-object v0, Lcom/melesta/engine/EngineApp;->mTD2PackageNames:[Ljava/lang/String;

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 26
    invoke-direct {p0}, Landroid/app/Application;-><init>()V

    return-void
.end method

.method public static checkInstalledToyDefense1()Z
    .locals 6

    .prologue
    const/4 v2, 0x0

    .line 145
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v0

    .line 146
    .local v0, app:Lcom/melesta/engine/EngineApp;
    if-nez v0, :cond_1

    .line 158
    :cond_0
    return v2

    .line 148
    :cond_1
    invoke-virtual {v0}, Lcom/melesta/engine/EngineApp;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v3

    .line 150
    .local v3, mPm:Landroid/content/pm/PackageManager;
    const/4 v2, 0x0

    .line 151
    .local v2, installed:Z
    sget-object v4, Lcom/melesta/engine/EngineApp;->mTD1PackageNames:[Ljava/lang/String;

    array-length v4, v4

    add-int/lit8 v1, v4, -0x1

    .local v1, i:I
    :goto_0
    if-ltz v1, :cond_0

    if-nez v2, :cond_0

    .line 153
    :try_start_0
    sget-object v4, Lcom/melesta/engine/EngineApp;->mTD1PackageNames:[Ljava/lang/String;

    aget-object v4, v4, v1

    const/4 v5, 0x0

    invoke-virtual {v3, v4, v5}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
    :try_end_0
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    .line 154
    const/4 v2, 0x1

    .line 151
    :goto_1
    add-int/lit8 v1, v1, -0x1

    goto :goto_0

    .line 155
    :catch_0
    move-exception v4

    goto :goto_1
.end method

.method public static checkInstalledToyDefense2()Z
    .locals 6

    .prologue
    const/4 v2, 0x0

    .line 162
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v0

    .line 163
    .local v0, app:Lcom/melesta/engine/EngineApp;
    if-nez v0, :cond_1

    .line 175
    :cond_0
    return v2

    .line 165
    :cond_1
    invoke-virtual {v0}, Lcom/melesta/engine/EngineApp;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v3

    .line 167
    .local v3, mPm:Landroid/content/pm/PackageManager;
    const/4 v2, 0x0

    .line 168
    .local v2, installed:Z
    sget-object v4, Lcom/melesta/engine/EngineApp;->mTD2PackageNames:[Ljava/lang/String;

    array-length v4, v4

    add-int/lit8 v1, v4, -0x1

    .local v1, i:I
    :goto_0
    if-ltz v1, :cond_0

    if-nez v2, :cond_0

    .line 170
    :try_start_0
    sget-object v4, Lcom/melesta/engine/EngineApp;->mTD2PackageNames:[Ljava/lang/String;

    aget-object v4, v4, v1

    const/4 v5, 0x0

    invoke-virtual {v3, v4, v5}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
    :try_end_0
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    .line 171
    const/4 v2, 0x1

    .line 168
    :goto_1
    add-int/lit8 v1, v1, -0x1

    goto :goto_0

    .line 172
    :catch_0
    move-exception v4

    goto :goto_1
.end method

.method public static copyTextToClipboard(Ljava/lang/String;)V
    .locals 3
    .parameter "str"

    .prologue
    .line 289
    :try_start_0
    invoke-static {}, Lcom/melesta/engine/EngineActivity;->getInstance()Lcom/melesta/engine/EngineActivity;

    move-result-object v1

    .line 290
    .local v1, ea:Lcom/melesta/engine/EngineActivity;
    if-nez v1, :cond_0

    .line 304
    .end local v1           #ea:Lcom/melesta/engine/EngineActivity;
    :goto_0
    return-void

    .line 292
    .restart local v1       #ea:Lcom/melesta/engine/EngineActivity;
    :cond_0
    new-instance v2, Lcom/melesta/engine/EngineApp$1;

    invoke-direct {v2, p0}, Lcom/melesta/engine/EngineApp$1;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, v2}, Lcom/melesta/engine/EngineActivity;->runOnUiThread(Ljava/lang/Runnable;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 301
    .end local v1           #ea:Lcom/melesta/engine/EngineActivity;
    :catch_0
    move-exception v0

    .line 302
    .local v0, e:Ljava/lang/Exception;
    const-string v2, "copyTextToClipboard"

    invoke-static {v2, v0}, Lcom/melesta/engine/Error;->processException(Ljava/lang/String;Ljava/lang/Exception;)V

    goto :goto_0
.end method

.method public static fileDelete(Ljava/lang/String;)V
    .locals 1
    .parameter "fn"

    .prologue
    .line 325
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v0

    invoke-static {v0}, Lcom/melesta/engine/DatabaseHelper;->getHelper(Landroid/content/Context;)Lcom/melesta/engine/DatabaseHelper;

    move-result-object v0

    invoke-virtual {v0, p0}, Lcom/melesta/engine/DatabaseHelper;->fileDelete(Ljava/lang/String;)V

    .line 326
    return-void
.end method

.method public static fileSave(Ljava/lang/String;[B)V
    .locals 1
    .parameter "fn"
    .parameter "data"

    .prologue
    .line 321
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v0

    invoke-static {v0}, Lcom/melesta/engine/DatabaseHelper;->getHelper(Landroid/content/Context;)Lcom/melesta/engine/DatabaseHelper;

    move-result-object v0

    invoke-virtual {v0, p0, p1}, Lcom/melesta/engine/DatabaseHelper;->saveFile(Ljava/lang/String;[B)V

    .line 322
    return-void
.end method

.method public static getApkFilePath()Ljava/lang/String;
    .locals 7

    .prologue
    .line 111
    :try_start_0
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v3

    .line 112
    .local v3, me:Lcom/melesta/engine/EngineApp;
    invoke-virtual {v3}, Lcom/melesta/engine/EngineApp;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v5

    .line 113
    .local v5, pm:Landroid/content/pm/PackageManager;
    invoke-virtual {v3}, Lcom/melesta/engine/EngineApp;->getPackageName()Ljava/lang/String;

    move-result-object v4

    .line 115
    .local v4, packageName:Ljava/lang/String;
    const/4 v6, 0x0

    invoke-virtual {v5, v6}, Landroid/content/pm/PackageManager;->getInstalledApplications(I)Ljava/util/List;

    move-result-object v6

    invoke-interface {v6}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v2

    .local v2, i$:Ljava/util/Iterator;
    :cond_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v6

    if-eqz v6, :cond_1

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/content/pm/ApplicationInfo;

    .line 116
    .local v0, app:Landroid/content/pm/ApplicationInfo;
    iget-object v6, v0, Landroid/content/pm/ApplicationInfo;->packageName:Ljava/lang/String;

    invoke-virtual {v6, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_0

    .line 117
    iget-object v6, v0, Landroid/content/pm/ApplicationInfo;->sourceDir:Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 124
    .end local v0           #app:Landroid/content/pm/ApplicationInfo;
    .end local v2           #i$:Ljava/util/Iterator;
    .end local v4           #packageName:Ljava/lang/String;
    .end local v5           #pm:Landroid/content/pm/PackageManager;
    :goto_0
    return-object v6

    .line 120
    :catch_0
    move-exception v1

    .line 121
    .local v1, e:Ljava/lang/Exception;
    invoke-static {v1}, Lcom/melesta/engine/Error;->processException(Ljava/lang/Exception;)V

    .line 124
    .end local v1           #e:Ljava/lang/Exception;
    :cond_1
    const/4 v6, 0x0

    goto :goto_0
.end method

.method public static getApp()Lcom/melesta/engine/EngineApp;
    .locals 1

    .prologue
    .line 44
    sget-object v0, Lcom/melesta/engine/EngineApp;->instance:Lcom/melesta/engine/EngineApp;

    return-object v0
.end method

.method public static getAppId()Ljava/lang/String;
    .locals 2

    .prologue
    .line 241
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v0

    .line 242
    .local v0, app:Lcom/melesta/engine/EngineApp;
    if-nez v0, :cond_0

    const-string v1, ""

    .line 243
    :goto_0
    return-object v1

    :cond_0
    invoke-virtual {v0}, Lcom/melesta/engine/EngineApp;->getPackageName()Ljava/lang/String;

    move-result-object v1

    goto :goto_0
.end method

.method public static getAppVersion()Ljava/lang/String;
    .locals 6

    .prologue
    .line 131
    sget-object v4, Lcom/melesta/engine/EngineApp;->instance:Lcom/melesta/engine/EngineApp;

    if-nez v4, :cond_0

    const-string v4, ""

    .line 141
    .local v2, packageManager:Landroid/content/pm/PackageManager;
    :goto_0
    return-object v4

    .line 134
    .end local v2           #packageManager:Landroid/content/pm/PackageManager;
    :cond_0
    :try_start_0
    sget-object v4, Lcom/melesta/engine/EngineApp;->instance:Lcom/melesta/engine/EngineApp;

    invoke-virtual {v4}, Lcom/melesta/engine/EngineApp;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v2

    .line 135
    .restart local v2       #packageManager:Landroid/content/pm/PackageManager;
    sget-object v4, Lcom/melesta/engine/EngineApp;->instance:Lcom/melesta/engine/EngineApp;

    invoke-virtual {v4}, Lcom/melesta/engine/EngineApp;->getPackageName()Ljava/lang/String;

    move-result-object v3

    .line 136
    .local v3, packageName:Ljava/lang/String;
    const/4 v4, 0x0

    invoke-virtual {v2, v3, v4}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;

    move-result-object v1

    .line 137
    .local v1, packageInfo:Landroid/content/pm/PackageInfo;
    iget-object v4, v1, Landroid/content/pm/PackageInfo;->versionName:Ljava/lang/String;
    :try_end_0
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 138
    .end local v1           #packageInfo:Landroid/content/pm/PackageInfo;
    .end local v3           #packageName:Ljava/lang/String;
    :catch_0
    move-exception v0

    .line 139
    .local v0, e:Landroid/content/pm/PackageManager$NameNotFoundException;
    const-string v4, "engine"

    const-string v5, "Package name not found"

    invoke-static {v4, v5, v0}, Lcom/melesta/engine/Log;->e(Ljava/lang/String;Ljava/lang/String;Landroid/content/pm/PackageManager$NameNotFoundException;)V

    .line 141
    const-string v4, ""

    goto :goto_0
.end method

.method public static getAssetManager()Landroid/content/res/AssetManager;
    .locals 3

    .prologue
    .line 98
    :try_start_0
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v0

    .line 99
    .local v0, app:Lcom/melesta/engine/EngineApp;
    if-eqz v0, :cond_0

    .line 100
    invoke-virtual {v0}, Lcom/melesta/engine/EngineApp;->getAssets()Landroid/content/res/AssetManager;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v2

    .line 105
    :goto_0
    return-object v2

    .line 101
    :catch_0
    move-exception v1

    .line 102
    .local v1, e:Ljava/lang/Exception;
    invoke-static {v1}, Lcom/melesta/engine/Error;->processException(Ljava/lang/Exception;)V

    .line 105
    .end local v1           #e:Ljava/lang/Exception;
    :cond_0
    const/4 v2, 0x0

    goto :goto_0
.end method

.method public static getConfigString(Ljava/lang/String;)Ljava/lang/String;
    .locals 9
    .parameter "key"
    .annotation build Landroid/annotation/SuppressLint;
        value = {
            "DefaultLocale"
        }
    .end annotation

    .prologue
    .line 196
    :try_start_0
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v1

    .line 197
    .local v1, me:Lcom/melesta/engine/EngineApp;
    if-nez v1, :cond_1

    .line 198
    const-string v3, ""

    .line 236
    .end local v1           #me:Lcom/melesta/engine/EngineApp;
    :cond_0
    :goto_0
    return-object v3

    .line 200
    .restart local v1       #me:Lcom/melesta/engine/EngineApp;
    :cond_1
    const-string v6, "RateMeUrl"

    invoke-virtual {p0, v6}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_3

    .line 201
    invoke-virtual {v1}, Lcom/melesta/engine/EngineApp;->getPackageName()Ljava/lang/String;

    move-result-object v2

    .line 202
    .local v2, packageName:Ljava/lang/String;
    invoke-virtual {v2}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v6

    const-string v7, "amazon"

    invoke-virtual {v6, v7}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v6

    if-eqz v6, :cond_2

    .line 204
    const-string v6, "http://www.amazon.com/gp/mas/dl/android?p=%s"

    const/4 v7, 0x1

    new-array v7, v7, [Ljava/lang/Object;

    const/4 v8, 0x0

    aput-object v2, v7, v8

    invoke-static {v6, v7}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    goto :goto_0

    .line 207
    :cond_2
    const-string v6, "market://details?id=%s"

    const/4 v7, 0x1

    new-array v7, v7, [Ljava/lang/Object;

    const/4 v8, 0x0

    aput-object v2, v7, v8

    invoke-static {v6, v7}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    goto :goto_0

    .line 210
    .end local v2           #packageName:Ljava/lang/String;
    :cond_3
    invoke-virtual {v1}, Lcom/melesta/engine/EngineApp;->getResources()Landroid/content/res/Resources;

    move-result-object v4

    .line 211
    .local v4, resources:Landroid/content/res/Resources;
    const-string v6, "TweetUrl"

    invoke-virtual {p0, v6}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_4

    .line 212
    sget v6, Lcom/melesta/engine/R$string;->TweetUrl:I

    invoke-virtual {v4, v6}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v3

    .line 213
    .local v3, res:Ljava/lang/String;
    goto :goto_0

    .line 216
    .end local v3           #res:Ljava/lang/String;
    :cond_4
    const-string v6, "TwitterHashTag"

    invoke-virtual {p0, v6}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_5

    .line 217
    sget v6, Lcom/melesta/engine/R$string;->TwitterHashTag:I

    invoke-virtual {v4, v6}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v3

    .line 218
    .restart local v3       #res:Ljava/lang/String;
    goto :goto_0

    .line 221
    .end local v3           #res:Ljava/lang/String;
    :cond_5
    const-string v6, "ToyDefense2App"

    invoke-virtual {p0, v6}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_6

    .line 222
    sget v6, Lcom/melesta/engine/R$string;->ToyDefense2App:I

    invoke-virtual {v4, v6}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v3

    .line 223
    .restart local v3       #res:Ljava/lang/String;
    goto :goto_0

    .line 227
    .end local v3           #res:Ljava/lang/String;
    :cond_6
    new-instance v5, Landroid/util/TypedValue;

    invoke-direct {v5}, Landroid/util/TypedValue;-><init>()V

    .line 228
    .local v5, tv:Landroid/util/TypedValue;
    const/4 v6, 0x1

    invoke-virtual {v4, p0, v5, v6}, Landroid/content/res/Resources;->getValue(Ljava/lang/String;Landroid/util/TypedValue;Z)V

    .line 229
    iget-object v6, v5, Landroid/util/TypedValue;->string:Ljava/lang/CharSequence;

    invoke-interface {v6}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;

    move-result-object v3

    .line 230
    .restart local v3       #res:Ljava/lang/String;
    if-nez v3, :cond_0

    const-string v3, ""
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 231
    .end local v1           #me:Lcom/melesta/engine/EngineApp;
    .end local v3           #res:Ljava/lang/String;
    .end local v4           #resources:Landroid/content/res/Resources;
    .end local v5           #tv:Landroid/util/TypedValue;
    :catch_0
    move-exception v0

    .line 232
    .local v0, e:Ljava/lang/Exception;
    const-string v6, "engine"

    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    const-string v8, "Can\'t get config value for "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7}, Lcom/melesta/engine/Log;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 236
    const-string v3, ""

    goto/16 :goto_0
.end method

.method public static getCurrentLanguage()Ljava/lang/String;
    .locals 1

    .prologue
    .line 48
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v0

    if-eqz v0, :cond_0

    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v0

    iget-object v0, v0, Lcom/melesta/engine/EngineApp;->mLanguage:Ljava/lang/String;

    :goto_0
    return-object v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public static getDeviceId()Ljava/lang/String;
    .locals 9

    .prologue
    .line 249
    sget-object v6, Lcom/melesta/engine/EngineApp;->mUuid:Ljava/lang/String;

    if-eqz v6, :cond_0

    sget-object v6, Lcom/melesta/engine/EngineApp;->mUuid:Ljava/lang/String;

    .line 283
    .local v1, app:Lcom/melesta/engine/EngineApp;
    :goto_0
    return-object v6

    .line 251
    .end local v1           #app:Lcom/melesta/engine/EngineApp;
    :cond_0
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v1

    .line 252
    .restart local v1       #app:Lcom/melesta/engine/EngineApp;
    if-nez v1, :cond_1

    const-string v6, ""

    goto :goto_0

    .line 254
    :cond_1
    const-string v6, "device_id.xml"

    const/4 v7, 0x0

    invoke-virtual {v1, v6, v7}, Lcom/melesta/engine/EngineApp;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v5

    .line 255
    .local v5, prefs:Landroid/content/SharedPreferences;
    const-string v6, "device_id"

    const/4 v7, 0x0

    invoke-interface {v5, v6, v7}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    .line 257
    .local v4, id:Ljava/lang/String;
    if-eqz v4, :cond_2

    .line 259
    sput-object v4, Lcom/melesta/engine/EngineApp;->mUuid:Ljava/lang/String;

    .line 283
    :goto_1
    sget-object v6, Lcom/melesta/engine/EngineApp;->mUuid:Ljava/lang/String;

    goto :goto_0

    .line 263
    :cond_2
    invoke-virtual {v1}, Lcom/melesta/engine/EngineApp;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v6

    const-string v7, "android_id"

    invoke-static {v6, v7}, Landroid/provider/Settings$Secure;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 269
    .local v0, androidId:Ljava/lang/String;
    :try_start_0
    const-string v6, "9774d56d682e549c"

    invoke-virtual {v6, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-nez v6, :cond_3

    .line 270
    const-string v6, "utf8"

    invoke-virtual {v0, v6}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object v6

    invoke-static {v6}, Ljava/util/UUID;->nameUUIDFromBytes([B)Ljava/util/UUID;

    move-result-object v6

    invoke-virtual {v6}, Ljava/util/UUID;->toString()Ljava/lang/String;

    move-result-object v6

    sput-object v6, Lcom/melesta/engine/EngineApp;->mUuid:Ljava/lang/String;
    :try_end_0
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_0 .. :try_end_0} :catch_0

    .line 280
    :goto_2
    invoke-interface {v5}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v6

    const-string v7, "device_id"

    sget-object v8, Lcom/melesta/engine/EngineApp;->mUuid:Ljava/lang/String;

    invoke-interface {v6, v7, v8}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    move-result-object v6

    invoke-interface {v6}, Landroid/content/SharedPreferences$Editor;->commit()Z

    goto :goto_1

    .line 272
    :cond_3
    :try_start_1
    const-string v6, "phone"

    invoke-virtual {v1, v6}, Lcom/melesta/engine/EngineApp;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Landroid/telephony/TelephonyManager;

    invoke-virtual {v6}, Landroid/telephony/TelephonyManager;->getDeviceId()Ljava/lang/String;

    move-result-object v2

    .line 273
    .local v2, deviceId:Ljava/lang/String;
    if-eqz v2, :cond_4

    const-string v6, "utf8"

    invoke-virtual {v2, v6}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object v6

    invoke-static {v6}, Ljava/util/UUID;->nameUUIDFromBytes([B)Ljava/util/UUID;

    move-result-object v6

    :goto_3
    invoke-virtual {v6}, Ljava/util/UUID;->toString()Ljava/lang/String;

    move-result-object v6

    sput-object v6, Lcom/melesta/engine/EngineApp;->mUuid:Ljava/lang/String;
    :try_end_1
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_2

    .line 275
    .end local v2           #deviceId:Ljava/lang/String;
    :catch_0
    move-exception v3

    .line 276
    .local v3, e:Ljava/io/UnsupportedEncodingException;
    new-instance v6, Ljava/lang/RuntimeException;

    invoke-direct {v6, v3}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/Throwable;)V

    throw v6

    .line 273
    .end local v3           #e:Ljava/io/UnsupportedEncodingException;
    .restart local v2       #deviceId:Ljava/lang/String;
    :cond_4
    :try_start_2
    invoke-static {}, Ljava/util/UUID;->randomUUID()Ljava/util/UUID;
    :try_end_2
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_2 .. :try_end_2} :catch_0

    move-result-object v6

    goto :goto_3
.end method

.method public static getFile(Ljava/lang/String;)[B
    .locals 1
    .parameter "fn"

    .prologue
    .line 317
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v0

    invoke-static {v0}, Lcom/melesta/engine/DatabaseHelper;->getHelper(Landroid/content/Context;)Lcom/melesta/engine/DatabaseHelper;

    move-result-object v0

    invoke-virtual {v0, p0}, Lcom/melesta/engine/DatabaseHelper;->getFile(Ljava/lang/String;)[B

    move-result-object v0

    return-object v0
.end method

.method public static getFileList()Ljava/util/List;
    .locals 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 309
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v0

    invoke-static {v0}, Lcom/melesta/engine/DatabaseHelper;->getHelper(Landroid/content/Context;)Lcom/melesta/engine/DatabaseHelper;

    move-result-object v0

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Lcom/melesta/engine/DatabaseHelper;->getFilesList(Z)Ljava/util/List;

    move-result-object v0

    return-object v0
.end method

.method public static isFileExist(Ljava/lang/String;)Z
    .locals 1
    .parameter "fn"

    .prologue
    .line 313
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v0

    invoke-static {v0}, Lcom/melesta/engine/DatabaseHelper;->getHelper(Landroid/content/Context;)Lcom/melesta/engine/DatabaseHelper;

    move-result-object v0

    invoke-virtual {v0, p0}, Lcom/melesta/engine/DatabaseHelper;->isExists(Ljava/lang/String;)Z

    move-result v0

    return v0
.end method

.method public static isNetworkAvailable()Z
    .locals 5

    .prologue
    const/4 v2, 0x0

    .line 180
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v3

    if-nez v3, :cond_1

    .line 189
    .local v0, cm:Landroid/net/ConnectivityManager;
    .local v1, netInfo:Landroid/net/NetworkInfo;
    :cond_0
    :goto_0
    return v2

    .line 183
    .end local v0           #cm:Landroid/net/ConnectivityManager;
    .end local v1           #netInfo:Landroid/net/NetworkInfo;
    :cond_1
    invoke-static {}, Lcom/melesta/engine/EngineApp;->getApp()Lcom/melesta/engine/EngineApp;

    move-result-object v3

    const-string v4, "connectivity"

    invoke-virtual {v3, v4}, Lcom/melesta/engine/EngineApp;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/ConnectivityManager;

    .line 185
    .restart local v0       #cm:Landroid/net/ConnectivityManager;
    invoke-virtual {v0}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;

    move-result-object v1

    .line 186
    .restart local v1       #netInfo:Landroid/net/NetworkInfo;
    if-eqz v1, :cond_0

    invoke-virtual {v1}, Landroid/net/NetworkInfo;->isConnectedOrConnecting()Z

    move-result v3

    if-eqz v3, :cond_0

    .line 187
    const/4 v2, 0x1

    goto :goto_0
.end method


# virtual methods
.method public onCreate()V
    .locals 13

    .prologue
    .line 53
    sput-object p0, Lcom/melesta/engine/EngineApp;->instance:Lcom/melesta/engine/EngineApp;

    .line 54
    invoke-super {p0}, Landroid/app/Application;->onCreate()V

    .line 55
    const-string v10, "java"

    const-string v11, "app - onCreate"

    invoke-static {v10, v11}, Lcom/melesta/engine/Log;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 58
    :try_start_0
    invoke-virtual {p0}, Lcom/melesta/engine/EngineApp;->getResources()Landroid/content/res/Resources;

    move-result-object v9

    .line 60
    .local v9, resources:Landroid/content/res/Resources;
    invoke-virtual {v9}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;

    move-result-object v1

    .line 61
    .local v1, configuration:Landroid/content/res/Configuration;
    iget-object v8, v1, Landroid/content/res/Configuration;->locale:Ljava/util/Locale;

    .line 62
    .local v8, locale:Ljava/util/Locale;
    invoke-virtual {v8}, Ljava/util/Locale;->getLanguage()Ljava/lang/String;

    move-result-object v10

    iput-object v10, p0, Lcom/melesta/engine/EngineApp;->mLanguage:Ljava/lang/String;

    .line 63
    const-string v10, "engine"

    new-instance v11, Ljava/lang/StringBuilder;

    invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V

    const-string v12, "Language:"

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    iget-object v12, p0, Lcom/melesta/engine/EngineApp;->mLanguage:Ljava/lang/String;

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    const-string v12, "  "

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v8}, Ljava/util/Locale;->getISO3Language()Ljava/lang/String;

    move-result-object v12

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v11

    invoke-static {v10, v11}, Lcom/melesta/engine/Log;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 64
    invoke-virtual {v8}, Ljava/util/Locale;->getCountry()Ljava/lang/String;

    move-result-object v2

    .line 65
    .local v2, country:Ljava/lang/String;
    const-string v10, "engine"

    new-instance v11, Ljava/lang/StringBuilder;

    invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V

    const-string v12, "Country:"

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v8}, Ljava/util/Locale;->getISO3Country()Ljava/lang/String;

    move-result-object v12

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    const-string v12, "  "

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v11

    invoke-static {v10, v11}, Lcom/melesta/engine/Log;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 67
    iget-object v10, p0, Lcom/melesta/engine/EngineApp;->mLanguage:Ljava/lang/String;

    const-string v11, "zh"

    invoke-virtual {v10, v11}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v10

    if-eqz v10, :cond_0

    const-string v10, "cn"

    invoke-virtual {v2, v10}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v10

    if-eqz v10, :cond_0

    .line 68
    const-string v10, "zh-hans"

    iput-object v10, p0, Lcom/melesta/engine/EngineApp;->mLanguage:Ljava/lang/String;

    .line 71
    :cond_0
    sget v10, Lcom/melesta/engine/R$array;->nativeLibs:I

    invoke-virtual {v9, v10}, Landroid/content/res/Resources;->getStringArray(I)[Ljava/lang/String;

    move-result-object v7

    .line 72
    .local v7, libs:[Ljava/lang/String;
    move-object v0, v7

    .local v0, arr$:[Ljava/lang/String;
    array-length v5, v0

    .local v5, len$:I
    const/4 v4, 0x0

    .local v4, i$:I
    :goto_0
    if-ge v4, v5, :cond_1

    aget-object v6, v0, v4

    .line 73
    .local v6, lib:Ljava/lang/String;
    const-string v10, "java"

    new-instance v11, Ljava/lang/StringBuilder;

    invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V

    const-string v12, "load lib "

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v11

    invoke-static {v10, v11}, Lcom/melesta/engine/Log;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 74
    invoke-static {v6}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V

    .line 72
    add-int/lit8 v4, v4, 0x1

    goto :goto_0

    .line 77
    .end local v6           #lib:Ljava/lang/String;
    :cond_1
    invoke-static {p0}, Lcom/melesta/engine/DatabaseHelper;->getHelper(Landroid/content/Context;)Lcom/melesta/engine/DatabaseHelper;

    .line 80
    invoke-static {}, Lcom/melesta/engine/NativeEngineCallbacks;->create()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 85
    .end local v0           #arr$:[Ljava/lang/String;
    .end local v1           #configuration:Landroid/content/res/Configuration;
    .end local v2           #country:Ljava/lang/String;
    .end local v4           #i$:I
    .end local v5           #len$:I
    .end local v7           #libs:[Ljava/lang/String;
    .end local v8           #locale:Ljava/util/Locale;
    .end local v9           #resources:Landroid/content/res/Resources;
    :goto_1
    const-string v10, "java"

    const-string v11, "app - onCreate-Done!"

    invoke-static {v10, v11}, Lcom/melesta/engine/Log;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 86
    return-void

    .line 81
    :catch_0
    move-exception v3

    .line 82
    .local v3, e:Ljava/lang/Exception;
    const-string v10, "app-onCreate"

    invoke-static {v10, v3}, Lcom/melesta/engine/Error;->processException(Ljava/lang/String;Ljava/lang/Exception;)V

    goto :goto_1
.end method

.method public onTerminate()V
    .locals 0

    .prologue
    .line 91
    invoke-static {}, Lcom/melesta/engine/NativeEngineCallbacks;->destroy()V

    .line 92
    invoke-super {p0}, Landroid/app/Application;->onTerminate()V

    .line 93
    return-void
.end method
